﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SaleOnlineStep1.ascx.cs" Inherits="ControlUser_SaleOnlineStep1" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register src="uscMsgBox.ascx" tagname="uscMsgBox" tagprefix="uc2" %>
<link rel="stylesheet" href='<%=ResolveUrl("~/LayoutCss/datePicker.css")%>' type="text/css" />
<script type="text/javascript"  src='<%=ResolveUrl("~/JScript/jquery.alphanumeric.js")%>'></script>
<link rel="stylesheet" href='<%=ResolveUrl("~/LayoutCss/K_BaoCaoFormLayout.css")%>' type="text/css" />

<script type="text/javascript">
    function pageLoad() {
        $("#<%= btSave.ClientID %>").click(function () {

            $.blockUI({
                message: '<h1>Xin vui lòng chờ xử lý</h1>',
                css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#f00',
                    opacity: .5,
                    color: '#fff'
                }
            });

        });

        $("#<%= btDeleteAll.ClientID %>").click(function () {

            $.blockUI({
                message: '<h1>Xin vui lòng chờ xử lý</h1>',
                css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#f00',
                    opacity: .5,
                    color: '#fff'
                }
            });

        });
        $("#<%= btContinues.ClientID %>").click(function () {

            $.blockUI({
                message: '<h1>Xin vui lòng chờ xử lý</h1>',
                css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#f00',
                    opacity: .5,
                    color: '#fff'
                }
            });

        });

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }
    }  
   
</script> 
<uc2:uscMsgBox ID="uscMsgBox1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <fieldset>
    <legend>Giỏ hàng của bạn</legend>
     <div class="fm-req">
                       <label for="txtMaTuVanVien">Mã BA:</label>
                       <asp:TextBox ID="txtMaTuVanVien" BackColor="Yellow" runat="server" ReadOnly="True" Width="150px"></asp:TextBox>
                   </div>
    <div class="fm-req">
                       <label for="txtTenTuVanVien">Họ tên:</label>
                       <asp:TextBox ID="txtTenTuVanVien" BackColor="Yellow"  ReadOnly="True" runat="server" Width="200px" MaxLength="30" TabIndex="1"></asp:TextBox>
    </div>

     <asp:GridView ID="grvDetailCart" AutoGenerateColumns="False"
                             DataKeyNames="Itemkey" 
                            
                             runat="server" onrowcancelingedit="grvDetailCart_RowCancelingEdit" 
                                onrowdeleting="grvDetailCart_RowDeleting"  Width="100%"
                                onrowediting="grvDetailCart_RowEditing" 
                                onrowupdating="grvDetailCart_RowUpdating" CellPadding="4" 
                                EnableModelValidation="True" ForeColor="#333333" GridLines="None">
                                <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                    <asp:TemplateField HeaderText="Stt" 
                                            HeaderStyle-Width="50" ItemStyle-Width="50" ItemStyle-Height="40"
                                            HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign ="left">
                                            <HeaderTemplate>STT</HeaderTemplate>
                                            <ItemTemplate><%# Container.DataItemIndex + 1 %></ItemTemplate>                                
                                            <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                    </asp:TemplateField>
                                   <asp:TemplateField HeaderText="Mã hàng" 
                                            HeaderStyle-Width="100" ItemStyle-Width="100" ItemStyle-Height="40"
                                            HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign ="left">
                                            <HeaderTemplate>Mã hàng</HeaderTemplate>
                                            <ItemTemplate>
                                           
                                            <asp:Label ID="lblMaHang" runat="server" Text='<%# Eval("Itemkey")%>'></asp:Label>
                                            </ItemTemplate>                                
                                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                    </asp:TemplateField>
                                     <asp:TemplateField HeaderText="Tên hàng" 
                                            HeaderStyle-Width="150" ItemStyle-Width="150" ItemStyle-Height="40"
                                            HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign ="left">
                                            <HeaderTemplate>Tên hàng</HeaderTemplate>
                                            <ItemTemplate>
                                           
                                            <asp:Label ID="lblTenHang" runat="server" Text='<%# Eval("Desc")%>'></asp:Label>
                                            </ItemTemplate>                                
                                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                    </asp:TemplateField>
                                   <asp:TemplateField HeaderText="Đơn giá" 
                                            HeaderStyle-Width="150" ItemStyle-Width="150" ItemStyle-Height="40"
                                            HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign ="left">
                                            <HeaderTemplate>Đơn giá</HeaderTemplate>
                                            <ItemTemplate>
                                          
                                            <asp:Label ID="lblDonGia" runat="server" Text='<%# Eval("Price")%>'></asp:Label>
                                            </ItemTemplate>                                
                                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                    </asp:TemplateField>
      
                               
                                   
                                     <asp:TemplateField HeaderText="Số lượng" 
                                            HeaderStyle-Width="150" ItemStyle-Width="150" ItemStyle-Height="40"
                                            HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign ="left">
                                            <HeaderTemplate>Số lượng</HeaderTemplate>
                                            <ItemTemplate>
                                           
                                             <asp:Label ID="lblSL" runat="server" Text='<%# Eval("Quantity")%>'></asp:Label>
                                            </ItemTemplate>                                
                                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                           <EditItemTemplate>
                                               <asp:TextBox ID="txtSL" Text='<%# Eval("Quantity")%>' runat="server"></asp:TextBox>
                                               <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" 
                                                        runat="server" Enabled="True" FilterType="Numbers" 
                                                        TargetControlID="txtSL">
                                                 </cc1:FilteredTextBoxExtender>
                                           </EditItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Khuyến mãi" 
                                            HeaderStyle-Width="150" ItemStyle-Width="150" ItemStyle-Height="40"
                                            HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign ="left">
                                            <HeaderTemplate>Khuyến mãi</HeaderTemplate>
                                            <ItemTemplate>
                                             <asp:CheckBox runat="server" ID="chCheckKM" /> 
                                            </ItemTemplate>                                
                                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                           
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Thành tiền" 
                                            HeaderStyle-Width="150" ItemStyle-Width="150" ItemStyle-Height="40"
                                            HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign ="left">
                                            <HeaderTemplate>Thành tiền</HeaderTemplate>
                                            <ItemTemplate><%# Eval("ThanhTien1", "{0:###,###}")%> </ItemTemplate>                                
                                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                           
                                    </asp:TemplateField>
                                     <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px"
                                                HeaderText="Sửa">
                                        <HeaderTemplate>
                                                 Sửa
                                        </HeaderTemplate>
                                        <ItemTemplate> 
                                                <asp:ImageButton ID="btnEdit" Width="20" Height="20" runat="server" CausesValidation="false" CommandName="Edit" ImageUrl="~/image/Edit file.png" />
                                        </ItemTemplate>                                 
                                        <EditItemTemplate> 
                                                <asp:ImageButton ID="btnUpdate" Width="20" Height="20" runat="server" CausesValidation="false" CommandName="Update" ImageUrl="~/image/Edit file.png" />
                                                <asp:ImageButton ID="btnUpdateCancel" Width="20" Height="20" runat="server" CausesValidation="false" CommandName="Cancel" ImageUrl="~/image/forw.png" />
                                        </EditItemTemplate>                                
                                        <HeaderStyle Width="20px" />
                                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                                      </asp:TemplateField>

                                    
                                   <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px"
                                         HeaderText="Xóa">
                                            <HeaderTemplate>
                                               Xóa
                                            </HeaderTemplate>
                                            <ItemTemplate> 
                                                <asp:ImageButton ID="btnDelete" Width="20" Height="20" runat="server" CausesValidation="false" CommandName="Delete" ImageUrl="~/image/Symbol-Delete.png" />
                                            </ItemTemplate>               
                                            <HeaderStyle Width="20px" />
                                            <ItemStyle HorizontalAlign="Center" Width="20px" />
                                 </asp:TemplateField>   

                            </Columns>
                                <FooterStyle  BackColor="#990000" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#066839" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                            </asp:GridView>
                            <!-- ----------------------------------------------------------------------------------------------- -->
                              <div class="fm-req">
                                <label for="txtMaTuVanVien">Tổng tiền (VND):</label>
                                         <asp:TextBox ID="lblTongTien" BackColor="Yellow" runat="server" ReadOnly="True" Width="150px"></asp:TextBox>
                                    
                                  </div>
                            <div>
                             <asp:Button ID="btSave"  runat="server" Text="Lưu đơn hàng" CausesValidation="false" 
                                          onclick="btSave_Click" />
                                &nbsp;<asp:Button ID="btDeleteAll"  runat="server" Text="Xóa hết" CausesValidation="false" 
                                          onclick="btDeleteAll_Click" />
                                 &nbsp;
                                <asp:Button ID="btContinues"  runat="server" Text="Tiếp tục mua hàng" CausesValidation="false" 
                                          onclick="btContinues_Click" />
                            </div>
    </fieldset>
</ContentTemplate>
</asp:UpdatePanel>